obj-m := linalter.o
linalter-objs += body.o lib.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)

all:
	make -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
	make -C $(KDIR) SUBDIRS=$(PWD) clean
	rm modules.order Module.markers -f
install: all
	cp linalter.ko /lib/modules/`uname -r`/kernel/drivers/
	depmod -a
	modprobe linalter
	if ! grep -q linalter /etc/modules ; then ( echo linalter | tee -a /etc/modules > /dev/null ) fi
uninstall:
	-rm -f /lib/modules/`uname -r`/kernel/drivers/linalter.ko
	depmod -a
	sed '/^linalter$$/d' /etc/modules > /tmp/linalter && mv /tmp/linalter /etc/modules
